//
//  DYAccountProxy.h
//  dyss_v2
//
//  Created by LXF on 16/1/28.
//  Copyright © 2016年 First Facility. All rights reserved.
//

#import "BaseModelProxy.h"
#import "DYAccount.h"
#import "DYNotificationKeySet.h"

typedef NSString * SMSTYPE_Type;
extern SMSTYPE_Type kSMSTYPE_Type_Forget;
extern SMSTYPE_Type kSMSTYPE_Type_Register;

Def_DYNotificationKey(kNC_Login)
Def_DYNotificationKey(kNC_Logout)


@interface DYAccountProxy : BaseModelProxy

proxyInterface(DYAccount);


-(void)setCurreAccountProxy;

///  检测是否登录
///
///  @return 如果已登录 返回 当前登录的用户，否则返回 nil
+ (DYAccountProxy *)isLogged;

///  用户登出
///  登出异步执行
///
///  @param finished 如果error为nil等出成功
- (void)logout:(void(^)(NSError *error))finished;


#pragma mark - 构造函数
+(instancetype)accountProxyWithAccount:(NSString *)Account password:(NSString *)password;

#pragma mark - 网络请求
-(void)loginSuccess:(void (^)(NSURLSessionDataTask *task, id responseObject,id target))success
            dataerr:(void (^)(NSURLSessionDataTask *task, id responseObject,XXError *error))dataerr
            failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;
// regist
-(void)registWithAuthCode:(NSString *)authCode Success:(void (^)(NSURLSessionDataTask *task, id responseObject,id target))success
            dataerr:(void (^)(NSURLSessionDataTask *task, id responseObject,XXError *error))dataerr
            failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;


#pragma mark - 类方法
+(void)forgetWithPassword:(NSString *)password
                 authCode:(NSString *)authCode
                  success:(void (^)(NSURLSessionDataTask *task, id responseObject,id target))success
                  dataerr:(void (^)(NSURLSessionDataTask *task, id responseObject,XXError *error))dataerr
                  failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;
+(void)smscWithType:(SMSTYPE_Type)type
                 tel:(NSString *)tel
                  success:(void (^)(NSURLSessionDataTask *task, id responseObject,id target))success
                  dataerr:(void (^)(NSURLSessionDataTask *task, id responseObject,XXError *error))dataerr
                  failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;
+(void)changePasswordWithAccountId:(NSString *)accountId
                  password:(NSString *)password
                  newPassword:(NSString *)newPassword
                  success:(void (^)(NSURLSessionDataTask *task, id responseObject,id target))success
                  dataerr:(void (^)(NSURLSessionDataTask *task, id responseObject,XXError *error))dataerr
                  failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;

+(void)changeNickNameWithAccountId:(NSString *)accountId
                          nickName:(NSString *)nickName
                           success:(void (^)(NSURLSessionDataTask *task, id responseObject,id target))success
                           dataerr:(void (^)(NSURLSessionDataTask *task, id responseObject,XXError *error))dataerr
                           failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;

@end
